home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-04-16 | 1.6 KB | 66 lines | [TEXT/CWIE] |
- // TFVector.h
- // Copyright: © 1994 - 1998 by Apple Computer, Inc., all rights reserved.
-
- #pragma once
- #ifndef TFVector_h
- #define TFVector_h
-
- #pragma import on
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=power
- #endif
-
- #include "TermIndex.h"
-
- #pragma IA_BEGIN_EXPORTS
-
- // TFComponent: what TFVector's are made of.
- struct TFComponent {
- TermID termID; // the TermID
- TermFreq freq; // the frequency of that term
- private:
- void* operator new(size_t size); // stack or array allocate only
- };
-
- // order function so that arrays of TFComponent can be sorted by qsort
- extern "C" { int TFComponentOrder(const void* c1, const void* c2); }
-
- // TFVector: available from a VectorIndex.
- class TFVector : public IAObject {
- friend class VectorIndex;
- public:
- TFVector(DocLength l);
- ~TFVector();
-
- bool Validate(bool verbose);
- void SetDocumentLength(DocLength len) {length = len;}
- DocLength GetDocumentLength() const {return length;}
-
- void SetComponents(TFComponent* comps) {components = comps;}
- TFComponent* GetComponents() const {return components;}
- private:
- IABlockSize ComponentsSize();
- void ComponentsWrite(IAOutputBlock* output);
- void ComponentsRead(IAInputBlock* input);
-
- TFVector(TFVector&); // don't define a copy constructor
-
- DocLength length; // the number of components in the vector
- TFComponent* components; // an array of TFComponents, sorted by termID
-
- };
-
- // returns a new TFVector which is the sum of the argument vectors
- //TFVector* SumTFVectors(TFVector** vectors, uint32 nVectors);
-
- #pragma IA_END_EXPORTS
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #endif
-
- #pragma import reset
-
- #endif
-